package ru.nosport.matrixaria.modules.user.rmreg.server;

import ru.nosport.matrixaria.modules.common.AppServerProcess;
import ru.nosport.matrixaria.core.MessageHandler;
import ru.nosport.matrixaria.core.MessageHandlerException;
import org.apache.commons.configuration.Configuration;

/**
 * User: Victor Fabrichenko
 * Date: 30.04.2009
 * Time: 11:01:08
 */
public class CushionClientApp implements Cushion, AppServerProcess {
	private String remoteName;

	public CushionClientApp(Configuration _conf){
		this.remoteName = _conf.getString("remoteCushionName");
		System.out.println(this.remoteName + "Client is running");
	}

	public String stuckNeedle(String _moduleName) {
		String ret = null;

		try {
			ret = (String) MessageHandler.sendMessage(this.remoteName, "stuckNeedle", new Object[]{_moduleName});
		} catch (MessageHandlerException e) {
			e.printStackTrace();
		}
		return ret;
	}

	public String getRezForTest() {
		String ret = null;
		try {
			ret = (String) MessageHandler.sendMessage(this.remoteName, "getRezForTest", new Object[]{});
		} catch (MessageHandlerException e) {
			e.printStackTrace();
		}
		return ret;
	}

	public boolean moduleStart() throws Exception {
		return true;
	}

	public boolean moduleStop() {
		return true;
	}

	public boolean isModuleRunning() {
		return false;
	}

	public String moduleStat() {
		return null;
	}
}
